package org.jay.angla.dialog;

import org.jay.angla.onlab.R;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class RecordNameDialog extends Dialog {

	private EditText mNameEditText;
	private Button mSaveButton;
	private Button mNotSaveButton;
	private Button mCancelButton;
	private Context mContext;

	public RecordNameDialog(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		setThisDialog();
		setTitle(context.getString(R.string.record_name_dialog_title));
		mContext = context;
	}

	private void setThisDialog() {
		View mView = LayoutInflater.from(getContext()).inflate(
				R.layout.dialog_set_recordname, null);
		super.setContentView(mView);
		mNameEditText = (EditText) mView.findViewById(R.id.et_recordname);
		mSaveButton = (Button) mView.findViewById(R.id.dialog_save_button);
		mNotSaveButton = (Button) mView
				.findViewById(R.id.dialog_not_save_button);
		mCancelButton = (Button) mView.findViewById(R.id.dialog_cancel_button);
		setCancelable(false);
	}

	public void setOnClickListener(View.OnClickListener listener) {
		mSaveButton.setOnClickListener(listener);
		mCancelButton.setOnClickListener(listener);
		mNotSaveButton.setOnClickListener(listener);
	}

	public String getEditText() {
		return mNameEditText.getEditableText().toString();
	}

	public void setEditText(String name) {
		mNameEditText.setText(name);
	}
}
